#ifndef IMAGEVIEWER_H
#define IMAGEVIEWER_H

#include <QWidget.h>

struct Line
{
	QPoint _start;
	QPoint _end;
	QColor _colour;
};

struct Point
{
	QPoint _point;
	double _cross_len;
	QColor _colour;
};

struct Text
{
	QPoint _top_left;
	QString _text;
	double _size;
	QColor _colour;

};

struct Circle
{
	QPoint _centre;
	double _radius;
	QColor _colour;
};

class ImageViewer : public QWidget
{
    Q_OBJECT

 public:
    ImageViewer(const QString& title = "Image");
    ~ImageViewer();

	// Set the image
	void setImage(QImage* image);

	// Draw overlays
	void drawLine(const QPoint& start, const QPoint& end, const QColor& c=Qt::blue);
	void drawPoint(const QPoint& point, const double cross_len=4, const QColor& c=Qt::blue);
	void drawCircle(const QPoint& centre, double radius, const QColor& c=Qt::blue);
	void drawText(const QPoint& top_left, const QString& text, double size=12.0, const QColor& c=Qt::blue);
	
	// Clear
	void clearOverlay();
	void clearImage();

 protected:
	void paintEvent(QPaintEvent* evt);

 private:
	 QImage* _image;

	 // Overlay objects
	 std::vector<Line> _lines;
	 std::vector<Point> _points;
	 std::vector<Circle> _circles;
	 std::vector<Text> _text;
};

 #endif // MAINWINDOW_H